package com.shujia.common_util.one;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Scanner;

public class ScannerDemo {

    public static void main(String[] args) throws Exception {
        // \\双斜杠
        InputStream is = new FileInputStream("D:\\aaa.txt");
        Scanner sc = new Scanner(is);
        /*
        hasNext() 判断是否有下一行
        如果有下一行会返回true, 如果没有的话返回false

        next(): 返回下一行数据, 并且下移一行游标的位置
         */
        while (sc.hasNext()) {
            String str = sc.next();
            System.out.println(str);
        }
    }
}
